// pages/artist/artist.js
Page({
  data: {
    statusBarHeight: 0,
    artist: {
      name: '夏日入侵企画',
      desc: '播浪乐队',
      avatar: 'https://img.js.design/assets/img/62d928f31ca1a51d20b3570c.webp',
      isFollowed: true,
      isVerified: true,
      songs: [
        { name: '人生浪费指南' },
        { name: '菲菲' },
        { name: '爱情转移' },
        { name: '想去海边' },
        { name: '画中仙' },
        { name: '人生浪费指南' }
      ]
    }
  },

  onLoad(options) {
    // 获取系统信息
    const systemInfo = wx.getSystemInfoSync();
    this.setData({
      statusBarHeight: systemInfo.statusBarHeight
    });

    if (options.name) {
      const artistName = decodeURIComponent(options.name);
      this.setData({
        'artist.name': artistName
      });
    }
  },

  onBackTap() {
    wx.navigateBack();
  },

  onFollowTap() {
    const { artist } = this.data;
    artist.isFollowed = !artist.isFollowed;
    this.setData({ artist });

    wx.showToast({
      title: artist.isFollowed ? '已关注' : '已取消关注',
      icon: 'none'
    });
  },

  onMoreTap(e) {
    const index = e.currentTarget.dataset.index;
    wx.showActionSheet({
      itemList: ['收藏到歌单', '分享', '下载'],
      success(res) {
        console.log(res.tapIndex);
      }
    });
  }
}); 